package com.wisemoresystem.seal.service;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.wisemoresystem.seal.base.service.BaseService;
import com.wisemoresystem.seal.model.t_d_verify_config;
import com.wisemoresystem.seal.util.SpringTools;

/**
 * 换人复核开关配置
 * 
 * @author Administrator
 *
 */
@Service
public class VerifyConfigService extends BaseService {

	//
	public List<Map<String, Object>> selectVerifyConfig() {
		String sql = "select * from t_d_verify_config t where t.status=0 order by t.created asc ";
		List<Map<String, Object>> list = jt.queryForList(sql);
		return list;
	}

	// 查询是否开启开关
	private boolean isStart(String module_name) {
		String hql = "from t_d_verify_config t where t.status=0 and t.name=?";
		t_d_verify_config config = super.findObj(hql, module_name);

		if (config == null) {
			return true;
		}
		return "关闭".equals(config.getFlag()) ? false : true;
	}

	public boolean isApplyStart() {
		return isStart("申请复核");
	}

	public boolean isPushStart() {
		return isStart("印章下发复核");
	}

	public boolean isGetStart() {
		return isStart("印章领用复核");
	}

	public boolean isGetUnMatchStart() {
		return isStart("领用不符复核");
	}

	public boolean isGetUnMatchHandleStart() {
		return isStart("不符处理复核");
	}

	public boolean isTransferStart() {
		return isStart("旧章移植申请复核");
	}

	public static void main(String[] args) {
		VerifyConfigService s = SpringTools.getBean(VerifyConfigService.class);
		System.err.println(s.isApplyStart());

	}
}
